<?php

require(__DIR__ . '/../../../../common/config/params.php');

$params = array_merge(
    require(__DIR__ . '/../../config/params.php')
);

return [
    'id' => 'api-console',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log', 'gii', 'queue'],
    'controllerNamespace' => 'api\console\controllers',
    'timeZone' => 'Asia/Shanghai',
    'modules' => [
        'gii' => 'yii\gii\Module',
        'app' => [
            'class' => 'api\modules\app\Module',
        ],
    ],
    'controllerMap' => [
        // 'epidemic-event' => [
        //     'class' => 'api\console\modules\epidemic\controllers\EventController',
        // ],
    ],
    'components' => [
        'log' => [
            'targets' => [
                // [
                //     'class' => 'yii\log\FileTarget',
                //     'levels' => ['info'],
                //     'logVars' => [],
                //     'logFile' => '@api/console/runtime/logs/app_info.log',
                // ],
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    'logVars' => [],
                    'categories' => ['no_event_id'],
                    'logFile' => '@api/console/runtime/logs/no_event_id.log',
                ],
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    'logVars' => [],
                    'logFile' => '@api/console/runtime/logs/app_error.log',
                ],
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    'logVars' => [],
                    'logFile' => '@api/console/runtime/logs/push_error.log',
                ],
            ],
        ],
        //'test_3' => [
          //  'class' => 'yii\db\Connection',
//            'dsn' => 'mysql:host=172.16.25.52;dbname=unit_qrcode;port=3306;',
//             'dsn' => 'mysql:host=192.168.71.3;dbname=unit_qrcode;port=3306;',
        //    'dsn' => 'mysql:host=172.16.5.110;dbname=unit_qrcode;port=3306;',
      //      'username' => 'unit_user',
    //        'password' => 'aaA5y6C9vL',
  //          'charset' => 'utf8',
//        ],
 'test_3'=>[
  'class' => 'yii\db\Connection',
            'dsn' => PAIDAN_DB_DSN,
            'username' => PAIDAN_DB_USERNAME,
            'password' => PAIDAN_DB_PASSWORD,
            'charset' => 'utf8',
        ],
        'test2' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=172.16.25.52;dbname=test2;port=3306;',
            'username' => 'paidan_test_user',
            'password' => 'aaA5y6C9vL', // PAIDAN_DB_PASSWORD
            'charset' => 'utf8',
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'cachePath' => __DIR__ . '/../../runtime/cache',
        ],
        'queue' => [
            'class' => yii\queue\db\Queue::class,
            'db' => 'test_3',
            'deleteReleased' => false,
            'mutex' => [
                'class' => yii\mutex\MysqlMutex::class,
                'db' => 'test_3',
            ],
        ],
        'dataCenter' => [
            'class' => 'api\components\DataCenter',
            'host' => 'http://172.16.25.56:23005',//'DATA_CENTER_HOST',
            'token' => '240e13b16eff42aeaec9bda8c5707f84',
        ],
        'curl' => [
            'class' => 'api\components\Curl',
        ],
        'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => PAIDAN_REDIS_HOST,
            'port' => PAIDAN_REDIS_PORT,
            'database' => PAIDAN_REDIS_DB,
        ],
    ],
    'params' => $params
];
